export function endLoop(iteratorObj: any, callback: Function) {
  if (!iteratorObj?.length) {
    return []
  }
  try {
    Array.prototype.forEach.call(iteratorObj, (item) => {
      if (callback(item) === true) {
        throw Error('End loop')
      }
    })
  } catch (err: any) {
    // eslint-disable-next-line no-ex-assign
    err = null
  }
}
